class Course:
    def __init__(self):
        self.college = 0
        self.discipline = ''
        self.isGraduate = 0
        self.credits = 0
        self.prereqs = []
        self.isHonors = 0
        self.courseName = ''
        self.bok = ''
        self.courseNum = 0
        self.sections = []
    def __init__(self,jsonEntry):
        self.college = int(jsonEntry['college'])
        self.discipline = jsonEntry['discipline']
        self.isGraduate = int(jsonEntry['isGraduate'])
        self.credits = int(jsonEntry['credits'])
        self.prereqs = [x for x in jsonEntry['prereqs']]
        self.isHonors = int(jsonEntry['isHonors'])
        self.courseName = jsonEntry['course']
        self.bok = jsonEntry['bok']
        self.courseNum = int(jsonEntry['courseNum'])
        self.desc = jsonEntry['desc']
        self.longName = jsonEntry['longName']
        self.sections = [Section(x) for x in jsonEntry['sections']]
        self.flexDates = ''
        try:
            self.flexDates = jsonEntry['flexDates']
        except KeyError:
            self.flexDates = ''
        
class Section:
    def __init__(self,sectArr):
        self.location = sectArr['location']
        self.instructor = sectArr['instructor']
        self.sectionNum = int(sectArr['sectionNum'])
        self.callNum = int(sectArr['callNum'])
        self.schedule = [dict(x) for x in sectArr['schedule']]
        
            
